package com.gjy.design.decorator.s2;

import java.util.Objects;

/**
 * @author gjy
 * @version 1.0
 * @since 2025-11-10 10:21:34
 */
public class Entry {

    private final Object value;
    private final long expireAt;

    public Entry(Object value, long expireAt) {
        this.value = value;
        this.expireAt = expireAt;
    }

    public Object getValue() {
        return value;
    }

    public long getExpireAt() {
        return expireAt;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Entry entry = (Entry) o;
        return expireAt == entry.expireAt &&
                Objects.equals(value, entry.value);
    }

    @Override
    public int hashCode() {
        return Objects.hash(value, expireAt);
    }

    @Override
    public String toString() {
        return "Entry{" +
                "value=" + value +
                ", expireAt=" + expireAt +
                '}';
    }

}
